package com.alcloud.springplus.domain;

import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @className: UserOrg
 * @description: 用户组织关系
 * @author: AllG
 * @createDate: 2018-12-14 09:11:32
 * @updateRemark: 更新说明
 */
@Data
@Entity
@Table(name = "t_user_org")
public class UserOrg implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 主键Id
     */
    @Id
    @Column(name = "f_user_org_id", unique = true, nullable = false)
    @TableGenerator(name = "table_seq", pkColumnValue = "t_user_org", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_seq")
    private Integer id;

    /**
     * 用户Id
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_user_id")
    private User user;

    /**
     * 组织ID
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_org_id")
    private Org org;

    /**
     * 顺序
     */
    @Column(name = "f_seq")
    private Integer seq;

    /**
     * 创建时间
     */
    @Column(name = "f_create_time", nullable = false)
    @CreationTimestamp
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "f_create_by")
    private Integer createBy;

    /**
     * 更新时间
     */
    @Column(name = "f_update_time")
    private Date updateTime;

    /**
     * 更新人
     */
    @Column(name = "f_update_by")
    private Integer updateBy;
}
